package com.xiaomitest;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

// 句子反转
public class ReverseSentence {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String sentence = br.readLine();
        char[] ch = sentence.toCharArray();
        int len = ch.length;
        reverse(ch,0,len - 1);
        int i = 0;
        while (i < len){
            int j = i;
            while (j < len && ch[j] != ' '){
                j++;
            }
            reverse(ch,i,j - 1);
            while (j < len && ch[j] == ' '){
                j++;
            }
            i = j;
        }
        String res = new String(ch,0,len);
        System.out.println(res);


        br.close();
    }

    private static void reverse(char[] ch,int i,int j){
        while (i < j){
            char t = ch[i];
            ch[i++] = ch[j];
            ch[j--] = t;

        }
    }
}
